package com.ty.day1;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2023/11/22 15:19
 */
public class Four {
    public static void main(String[] args) {
        String[] str = {"tom", "jack", "alice", "rose", "jerry"};
        for (int i=0;i<str.length;i++){
            str[i] = str[i].toUpperCase();
        }
        System.out.println(Arrays.toString(str));
        for (int i = 0; i < str.length-1; i++) {
            for (int j = 0; j < str.length-i-1; j++) {
                if (str[j].length()>str[j+1].length()){
                    String s=str[j];
                    str[j]=str[j+1];
                    str[j+1]=s;
                }
            }
        }
        System.out.println(Arrays.toString(str));
    }
}
